import test from './test.mock'
import { MockMethod } from 'vite-plugin-mock'
import { RequestHttpEnum } from '@/enums/httpEnum'
import { axiosPre } from '@/settings/httpSetting'

// 单个X数据
export const chartDataUrl = axiosPre + '/mock/chartData'
export const chartSingleDataUrl = axiosPre + '/mock/chartSingleData'
export const numberFloatUrl = axiosPre + '/mock/number/float'
export const numberIntUrl = axiosPre + '/mock/number/int'
export const textUrl = axiosPre + '/mock/text'
export const imageUrl = axiosPre + '/mock/image'
export const rankListUrl = axiosPre + '/mock/rankList'
export const scrollBoardUrl = axiosPre + '/mock/scrollBoard'
export const radarUrl = axiosPre + '/mock/radarData'
export const heatMapUrl = axiosPre + '/mock/heatMapData'
export const scatterBasicUrl = axiosPre + '/mock/scatterBasic'
export const mapUrl = axiosPre + '/mock/map'
export const capsuleUrl = axiosPre + '/mock/capsule'
export const wordCloudUrl = axiosPre + '/mock/wordCloud'
export const treemapUrl = axiosPre + '/mock/treemap'
export const threeEarth01Url = axiosPre + '/mock/threeEarth01Data'
export const sankeyUrl = axiosPre + '/mock/sankey'
export const graphUrl = axiosPre + '/mock/graphData'

export const projectListUrl = axiosPre + '/project/list'
export const createProjectApi = axiosPre + '/project/create'
// 项目详情
export const fetchProjectApi = axiosPre + '/project/getData'
// 保存项目
export const saveProjectApi = axiosPre + '/project/save/data'
// 修改项目基础信息
export const updateProjectApi = axiosPre + '/project/edit'
// 删除项目
export const deleteProjectApi = axiosPre + '/project/delete'
// 发布项目
export const changeProjectReleaseApi = axiosPre + '/project/publish'

// 上传文件
export const uploadFile = axiosPre + '/project/upload'

// 登录退出
// 登录
export const loginApi = axiosPre + '/sys/login'
export const logoutApi = axiosPre + '/sys/logout'
// // * 获取 oss 上传接口
export const ossUrlApi = axiosPre + '/sys/getOssInfo'

const mockObject: MockMethod[] = [
  {
    url: updateProjectApi,
    method: RequestHttpEnum.POST,
    response: () => test.updateProjectData
  },
  {
    url: deleteProjectApi,
    method: RequestHttpEnum.DELETE,
    response: () => test.emptyJSON
  },
  {
    url: changeProjectReleaseApi,
    method: RequestHttpEnum.PUT,
    response: () => test.emptyJSON
  },
  {
    url: saveProjectApi,
    method: RequestHttpEnum.POST,
    response: () => test.saveProjectData
  },
  {
    url: fetchProjectApi,
    method: RequestHttpEnum.GET,
    response: () => test.getProjectData
  },
  {
    url: uploadFile,
    method: RequestHttpEnum.POST,
    response: () => test.uploadFile
  },
  {
    url: logoutApi,
    method: RequestHttpEnum.GET,
    response: () => test.logout
  },
  {
    // 正则
    // url: /\/mock\/mockData(|\?\S*)$/,
    url: loginApi,
    method: RequestHttpEnum.POST,
    response: () => test.login
  },
  {
    // 正则
    // url: /\/mock\/mockData(|\?\S*)$/,
    url: createProjectApi,
    method: RequestHttpEnum.POST,
    response: () => test.createProject
  },
  {
    // 正则
    // url: /\/mock\/mockData(|\?\S*)$/,
    url: projectListUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchProjectList
  },
  {
    // 正则
    // url: /\/mock\/mockData(|\?\S*)$/,
    url: chartDataUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchMockData
  },
  {
    url: chartSingleDataUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchMockSingleData
  },
  {
    url: numberFloatUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchNumberFloat
  },
  {
    url: numberIntUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchNumberInt
  },
  {
    url: textUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchText
  },
  {
    url: imageUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchImage(Math.round(Math.random() * 10))
  },
  {
    url: rankListUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchRankList
  },
  {
    url: scrollBoardUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchScrollBoard
  },
  {
    url: radarUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchRadar
  },
  {
    url: heatMapUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchHeatmap
  },
  {
    url: scatterBasicUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchScatterBasic
  },
  {
    url: mapUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchMap
  },
  {
    url: capsuleUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchCapsule
  },
  {
    url: wordCloudUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchWordCloud
  },
  {
    url: treemapUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchTreemap
  },
  {
    url: threeEarth01Url,
    method: RequestHttpEnum.GET,
    response: () => test.threeEarth01Data
  },
  {
    url: sankeyUrl,
    method: RequestHttpEnum.GET,
    response: () => test.fetchSankey
  },
  {
    url: graphUrl,
    method: RequestHttpEnum.GET,
    response: () => test.graphData
  }
]

export default mockObject
